<?php
  /**
   * @author EVANDRO DE OLIVEIRA.
   * @category VIEW
   * @package VIEWS/SCRIPTS/PAISES.
   * @since 17/06/2012.
   * @last_update 17/06/2012.
   * @copyright 2012.
   * @version 1.0.
   *
   */
?>
<script type="text/javascript">
  $(function(){
    $("input:text:eq(0):visible").focus();
  });
</script>
<table border="0" align="center" cellpadding="0" cellspacing="0" class="content-view" id="teste">
  <tr>
    <td id="messenger" colspan="2"><?php echo $this->flashMessage();?></td>
  </tr>
  <tr>
    <td align="left" class="comp-title" style="width: 210px;">ATUALIZAÇÃO DE <?php echo $this->strTitleP?></td>  
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center" colspan="2" style="">
      <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%" class="content-form">
        <tr>
          <td class="space-bottom"></td>
        </tr>
        <tr>
          <td>
            <form name="form_add" method="post" action="" id="form_add">
              <table border="0" align="center" cellpadding="0" cellspacing="0">
                <?php 
                  //Core_Commons::debugging($this->request);
                  //Core_Commons::debugging($this->arrColunas);
                  
                  foreach($this->arrColunas as $strKey => $arrValues){
                  	foreach($this->request as $arrData){	
                  		//Core_Commons::debugging($arrData);
	                    switch($arrValues['type']){
	                      case 'text':
	                        $strCampo = $this->input($arrValues['type'], $arrValues['name'], $arrValues['name'], $arrData[$arrValues['name']], true, '', $arrValues['maxlength'], '', "width: {$arrValues['width']}px;");
	                      break;
	
	                      case 'db_combo':
	                        $strCampo = $this->dbComboBox($arrValues['name'], $arrValues['name'], $arrValues['model'], $arrValues['value'], $arrValues['label'], $arrData[$arrValues['value']], $arrData[$arrValues['label']], $arrValues['name']);
	                      break;
	
	                      case 'combo':
	                        $strCampo = $this->comboBox($arrValues['name'], $arrValues['name'], $arrValues['options'], $arrData[$arrValues['name']]);
	                      break;
	                      
	                      case 'date':
	                      case 'datetime':  
	                        $strCampo = $this->input('text', $arrValues['name'], $arrValues['name'] , $arrValues['default_value'], true, '', '', $arrValues['maxlength'], "width: {$arrValues['width']}px;");
	                      break;
	                      
	                      case 'hidden': 
	                      	$strCampo = $this->input('hidden', $arrValues['name'], $arrValues['name'] , $arrData[$arrValues['name']], true); 
	                      break;	
	                    }
	                    ?>
		                  <tr>
	                      <td align="right" class="label"><?php if($strKey != 'Id'): echo $strKey . ':'; else: ''; endif;?></td>  
	                      <td align="left" class="space-bottom"><?php echo $strCampo?></td>                      
	                    </tr>
	                    <?php
                    }  
                  }
                ?>
                <tr>  
                  <td align="center" colspan="3">
                    <?php 
                      echo $this->input('submit', 'save', 'boton', 'Cadastrar', true);
                      echo'<span>&nbsp;</span>';
                      echo $this->input('button', 'cancel', 'boton', 'Cancelar', true, '', '', '', '', "onclick=\"window.location='list'\"");
                      echo $this->input('hidden', $strName, $strName , $intId, true);
                    ?>
                  </td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>  
</table>